UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JftCJ9yJTzlbEfeo1u6JRaZWlwDDEIMY37LGWIDp0ck=' 
WHERE 
  key_id = 'e5e246511ad8ec99eb518a68c105de50cd6a138f3632586e337f8269e22ae693' 
  AND (
    token = 'JftCJ9yJTzlbEfeo1u6JRaZWlwDDEIMY37LGWIDp0ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023