UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MUtUEuAE70F26BTUyvXygqAiqd60Y8VAGeBodzt2Xug=' 
WHERE 
  key_id = 'afa050fb5e92d7226a41f9276673a20b1bb06789531fa012f4d89d2dce9b1928' 
  AND (
    token = 'MUtUEuAE70F26BTUyvXygqAiqd60Y8VAGeBodzt2Xug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042