UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQ6JbMHQWfjVhxdVHAMvL5tyc0notiXvMz0MPzDARlA=' 
WHERE 
  key_id = '4cb3bb1b702f86abbd16d1c19ab3d4e72e679d72e2fcddb40cc0c46619342383' 
  AND (
    token = 'XQ6JbMHQWfjVhxdVHAMvL5tyc0notiXvMz0MPzDARlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022