UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tHyy53RNu3VS7Qx6hss5PCLVjwaC5Hro4KxY9d+Z/sQ=' 
WHERE 
  key_id = '9824ba7581099f27b086c5f55a48abe433bf6a5499fc85656019a00414416c58' 
  AND (
    token = 'tHyy53RNu3VS7Qx6hss5PCLVjwaC5Hro4KxY9d+Z/sQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030