UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rr623bwjMKZosmEt/UUSYrGtGsselHy22ikEtuzmnjU=' 
WHERE 
  key_id = '895c0b0e9c9d320061bdbfb861a4a393cb01754398629d54f441f0d05efd61bf' 
  AND (
    token = 'rr623bwjMKZosmEt/UUSYrGtGsselHy22ikEtuzmnjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019