UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Up1RXVnAVsOmILa84L/UXvbves6HEaS73uORTotGo38=' 
WHERE 
  key_id = '66502e7f4c5d7e8074add6630f2d55f820b37b98ed8f1e5e3689f070278e7cde' 
  AND (
    token = 'Up1RXVnAVsOmILa84L/UXvbves6HEaS73uORTotGo38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026