UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RAou/Guaf02D3huvyj55CRotnUMxMR485gB/TDcQZbE=' 
WHERE 
  key_id = '59f4e178cc28077939d5f414b7f47c05d7b3fc2c457b530b0d55c7ec23038dbf' 
  AND (
    token = 'RAou/Guaf02D3huvyj55CRotnUMxMR485gB/TDcQZbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040