UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LV8UIDimf2Sj+0sQnNepdu/LVjCSzrrF/T6Nilwx8ds=' 
WHERE 
  key_id = '92b072762a5602698ab14852b082a91e2b1c7c91947437bb6370b81d2f21cfe7' 
  AND (
    token = 'LV8UIDimf2Sj+0sQnNepdu/LVjCSzrrF/T6Nilwx8ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039