UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uXMdEk7D6/Rs79y+zVj6479GnhPwhijbK73qXbEx0oM=' 
WHERE 
  key_id = '1ed05b3b4583897dd412fe3c4da2f1f65cbf8bc12a73ea65b8e64f5639a2314b' 
  AND (
    token = 'uXMdEk7D6/Rs79y+zVj6479GnhPwhijbK73qXbEx0oM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040