UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nX1OGjkohH726NJwlEaOLXBFjAEPZUEASgJfOthQR2Q=' 
WHERE 
  key_id = '206e20aad0e370ac86323d84237a4396d738db418763fa04ecc7b7fb45167003' 
  AND (
    token = 'nX1OGjkohH726NJwlEaOLXBFjAEPZUEASgJfOthQR2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041