UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NPSZnZ8NnscCqB/14OW1FgGvm0tXVbgcBBb+GvErq3A=' 
WHERE 
  key_id = '3caf55aa69012e878e3aaf21527cfb03bef6d15de44ce6f2da366ad9f4941958' 
  AND (
    token = 'NPSZnZ8NnscCqB/14OW1FgGvm0tXVbgcBBb+GvErq3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051