UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xCeD2IFcNR23a0afbMM8Ae8WnSspfj+dyrruIqdb+Ds=' 
WHERE 
  key_id = '89eab03d7ded610d459af1e25f0ebc870b52050acf3dc61d1b18fe58573c073f' 
  AND (
    token = 'xCeD2IFcNR23a0afbMM8Ae8WnSspfj+dyrruIqdb+Ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034