UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8l39nEikfshWhaJbjkCDgkw5ddLjWVwZmrXXiau9nLc=' 
WHERE 
  key_id = 'c8a5a9e9a56b8075ce91be040fd12665b8cb12447be79e630731f2ff4928bcdd' 
  AND (
    token = '8l39nEikfshWhaJbjkCDgkw5ddLjWVwZmrXXiau9nLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032