UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CSQsmg/iXQyE7WnUrXRQRybLB1qhxGSKjzHulZJlqBA=' 
WHERE 
  key_id = '0d176d9b41c00148485a1fde07790ff063cd1b93ce1c122f581b631dd001d8b2' 
  AND (
    token = 'CSQsmg/iXQyE7WnUrXRQRybLB1qhxGSKjzHulZJlqBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044