UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZoXr/PZCnZJacIKABcuIL9GSVCr1eomhgepzumlhfM=' 
WHERE 
  key_id = 'f001355849e973cd6752b6143a231c90432ca372a259b41bdfda8140a6bc05b9' 
  AND (
    token = 'TZoXr/PZCnZJacIKABcuIL9GSVCr1eomhgepzumlhfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026