UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PZkYvFiZzt54ycGgBZ3eQe7Ii5y2pbEeXmdtq/1EcOU=' 
WHERE 
  key_id = 'bb56981566e25a7c35b2e4d10efb38417c448dccbb786b65d6e669ca761c652f' 
  AND (
    token = 'PZkYvFiZzt54ycGgBZ3eQe7Ii5y2pbEeXmdtq/1EcOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034