UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MQoYUuoUOuv/sPgVEK80XphPRnzSr3A1Ofgu9a8Qs2c=' 
WHERE 
  key_id = 'd157281086cd8d379df7fe0851f1f92950787b21d869fca5cffe2022dd75aa0d' 
  AND (
    token = 'MQoYUuoUOuv/sPgVEK80XphPRnzSr3A1Ofgu9a8Qs2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035