UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L8t/mV7MgTvxkb9mCUo0CbCu9ys5wODeo5fGcojVGzY=' 
WHERE 
  key_id = '81b2135a44e63cabfa1abcf5228280f38e98a27e6c4122e454d7aa97b50c71d0' 
  AND (
    token = 'L8t/mV7MgTvxkb9mCUo0CbCu9ys5wODeo5fGcojVGzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040