UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't0+p0VrcLT0Hwz1u0qlkfRNx2NXQGJekPYy48Xv3x44=' 
WHERE 
  key_id = '0fb54f4741ee9cdf79744dfc2eb0e4bbb11d684728b18607a18e8303502b8d95' 
  AND (
    token = 't0+p0VrcLT0Hwz1u0qlkfRNx2NXQGJekPYy48Xv3x44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035