UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5lLIdNf8mhEhf6Xq/PWFLy8RrznaDmJHKbAzIgjsAwc=' 
WHERE 
  key_id = 'c48100c68250cc6b85395dcd13eabc94e8785beaf9bed60574857200bd4a764d' 
  AND (
    token = '5lLIdNf8mhEhf6Xq/PWFLy8RrznaDmJHKbAzIgjsAwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038