UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iubi13i9eav9J2w8Ct/egKeilvyqbDUTuC56OpR14eg=' 
WHERE 
  key_id = 'f6de094776474760b0295584ffa424e57bac0fc62a2bcf43e565d07d7c1ed572' 
  AND (
    token = 'Iubi13i9eav9J2w8Ct/egKeilvyqbDUTuC56OpR14eg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021