UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'StTG/lqNPlQU9hDITZ0DX2khoCbA/5VwXFWzcd7PS6w=' 
WHERE 
  key_id = '3d5a1650b43edd82b9e5a0fd43002c7cf6fb3263f4343be9578aa13f15cc09eb' 
  AND (
    token = 'StTG/lqNPlQU9hDITZ0DX2khoCbA/5VwXFWzcd7PS6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048