UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wo4PmzN+oulAytSBB26fD+aEalIbY/G8iuBiJEHJH6Q=' 
WHERE 
  key_id = 'eef8b58180b65e463bc1a6922e90fa48b9915ae544990b9cabc0817edfeb6b32' 
  AND (
    token = 'wo4PmzN+oulAytSBB26fD+aEalIbY/G8iuBiJEHJH6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032