UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bl+RZao+8GrIRLe16R1+QO5c+IjEE66k79dZV7WrwUY=' 
WHERE 
  key_id = 'c3570d09ecf6ff79b87d3473ebb95b4171e3289d7f7a1b60e561a24769560f6c' 
  AND (
    token = 'bl+RZao+8GrIRLe16R1+QO5c+IjEE66k79dZV7WrwUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048