UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CXs+0wBE7M7s3YnKKbteSk3VsE8+wD3BPABO+PsHF+w=' 
WHERE 
  key_id = '71847402103bef25cf3d6e4335a21284c1a07862217978a8d6be5ebaf0c9bd08' 
  AND (
    token = 'CXs+0wBE7M7s3YnKKbteSk3VsE8+wD3BPABO+PsHF+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039