UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7RJ81IrTo6IRUBNado3lUkLeypBIxe2On8hMghHKd9U=' 
WHERE 
  key_id = 'd70d740885e70b40193ff1344f71814d176febb20de228ff34320588fe85e311' 
  AND (
    token = '7RJ81IrTo6IRUBNado3lUkLeypBIxe2On8hMghHKd9U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033