UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yThiHXMkM200QkYCJ9NgjUAUn+yp0waColN9X9A7hxk=' 
WHERE 
  key_id = '187b74977695bd6a15a801e12fc0aaac9bc249aeeb71b2a1566b3bd1c4d6ff06' 
  AND (
    token = 'yThiHXMkM200QkYCJ9NgjUAUn+yp0waColN9X9A7hxk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041