UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQUb9iruIKEt3q3+v960ZnleAA3oYVM0NyDauJXugIc=' 
WHERE 
  key_id = 'cb8b4780cd9c50ff75ecb594ce9d36f83a44bff34eced50a84d95d836c22c65a' 
  AND (
    token = 'bQUb9iruIKEt3q3+v960ZnleAA3oYVM0NyDauJXugIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027