UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWWMGLdyI8h7R9p/plG5v4v1ZjGumk/tf7RxOf027Ns=' 
WHERE 
  key_id = '791b3b26ad1ed26df728f69810e1f9be90be92c5cba90c47d36665de724b1fd0' 
  AND (
    token = 'YWWMGLdyI8h7R9p/plG5v4v1ZjGumk/tf7RxOf027Ns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044