UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IIq3fw1PGJb6sw0JsZx3gyM/eXVGeUvQnc+u8TMopoA=' 
WHERE 
  key_id = '6a85b3e2c87ed4cbd477286df966da7f93e5667c922967f545ceff85fad8720a' 
  AND (
    token = 'IIq3fw1PGJb6sw0JsZx3gyM/eXVGeUvQnc+u8TMopoA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029