UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oauWWRGMY2KoYYV8ON3FW4HWz50GmHUFBAqvKkAVD4s=' 
WHERE 
  key_id = '7330f8545762646c0c901974eba07d57676164b145471a98a202277f2a1bc5e2' 
  AND (
    token = 'oauWWRGMY2KoYYV8ON3FW4HWz50GmHUFBAqvKkAVD4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032