UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ovkj4/4toQ1NtHhHcNFX7okuRQbTAgy9CR0j+RJsLI8=' 
WHERE 
  key_id = '012c77cc8770b78dc3416524665b56b77c6699da8f43ca162a99b96724719287' 
  AND (
    token = 'Ovkj4/4toQ1NtHhHcNFX7okuRQbTAgy9CR0j+RJsLI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035