UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lL2UGLcqlq01kz4qSQdyAmOlRgMOxqZpyjdZJXs1Swc=' 
WHERE 
  key_id = 'def92bf36257aa9790484b1aeaa201f58d6ff9cae1277c3700ea3d96617da113' 
  AND (
    token = 'lL2UGLcqlq01kz4qSQdyAmOlRgMOxqZpyjdZJXs1Swc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051