UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's7RcfdM/TpoR4jICr5N5rHmpfEJL7omAAjWNcZHFvLk=' 
WHERE 
  key_id = '178a0703a8d114c4c5e005d5da58fd4f3deeeb1fa480b515230de50970b17031' 
  AND (
    token = 's7RcfdM/TpoR4jICr5N5rHmpfEJL7omAAjWNcZHFvLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015