UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5XLoCk6EI4xw3N4o6Zd4tksakx78E+Y8Eg0BJojr6Co=' 
WHERE 
  key_id = 'ddecb165ae86eaf7e865762d2d15b520715c5d9ad76e4a528c56c8754838fcbb' 
  AND (
    token = '5XLoCk6EI4xw3N4o6Zd4tksakx78E+Y8Eg0BJojr6Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036