UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rlH7PrZP0A1ToVvviKGeX1d7m9nUO5dhLmMgH9rwYZE=' 
WHERE 
  key_id = '5deedd28e4246ec51f8bf6a156782a7c2556f1015e4bacab3d59ebc494358f85' 
  AND (
    token = 'rlH7PrZP0A1ToVvviKGeX1d7m9nUO5dhLmMgH9rwYZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046