UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2dIOWBGqxb6xZjGSDcyx2RfixOLhaz9Yns1rTyJJ1kU=' 
WHERE 
  key_id = '3bc4ab536867010cdf80abed2e6202461f3ba3a37e0da5e95b6e4617d0c57a14' 
  AND (
    token = '2dIOWBGqxb6xZjGSDcyx2RfixOLhaz9Yns1rTyJJ1kU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032