UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OCyv8O3RKzOucwPlmIor8kjC7rtFrxQAyIPkMeLwr2o=' 
WHERE 
  key_id = '8f5aba50006294a90f70328d76b562f6ca87f6c913b546746f4ee98116b244c1' 
  AND (
    token = 'OCyv8O3RKzOucwPlmIor8kjC7rtFrxQAyIPkMeLwr2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033