UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'stjGpTTH3G6G6CxDH9WE6wRjR0GueGdDtjTDoGcEZ2E=' 
WHERE 
  key_id = '0e49b9f908172ab340027fc93d5716829ddd58d8af45aeccd344f1e56c05c0ed' 
  AND (
    token = 'stjGpTTH3G6G6CxDH9WE6wRjR0GueGdDtjTDoGcEZ2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080