UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2bwPW0RSUohiqq38Mev4Vn3FP+makq4PKxdd6AbEwzk=' 
WHERE 
  key_id = '050121139cb6c5858fb4f6ee4878fb72fdd349860e8119c1782ad9de4b019069' 
  AND (
    token = '2bwPW0RSUohiqq38Mev4Vn3FP+makq4PKxdd6AbEwzk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023