UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AK7+S/e5ay9QZyLiEysyJ/CLLXWKnilt11P65DRe5BE=' 
WHERE 
  key_id = '434c793d4ab710e3b5677aaab908fd5534663e0cf9149162646a0b895080d8d9' 
  AND (
    token = 'AK7+S/e5ay9QZyLiEysyJ/CLLXWKnilt11P65DRe5BE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018