UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oFtHksm0FWjqcKBNwqKMsh8MRc/RwRHrB42ESHgo1RQ=' 
WHERE 
  key_id = '00cc887162bb66178becfa41858d8ea97c69ef4b1b851935a526666358663230' 
  AND (
    token = 'oFtHksm0FWjqcKBNwqKMsh8MRc/RwRHrB42ESHgo1RQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050