UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SF23qbA5/nBjbaSL9+Qtwee5Bkax9c/1Ty5zPbJ/iU4=' 
WHERE 
  key_id = 'bb83404cb860a0348394a54163c7c996ca10b74be00d9764825bdad0fc1519f7' 
  AND (
    token = 'SF23qbA5/nBjbaSL9+Qtwee5Bkax9c/1Ty5zPbJ/iU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042